www.gusucode.com > 落叶冰点万能企业网站内容管理系统 V9.1 > 落叶冰点万能企业网站内容管理系统 V9.1\code\Model\ComponentLabels\省市县下拉选择框控件\addmode_label.asp

    <%'$start_ext_newDsoft 以下系统生成,勿删!
'$newDsoft_label_type$:asp_label$end_newDsoft_label_type$
'$newDsoft_label_name$:$addmode$-ComponentLabel-$$end_newDsoft_label_name$
'$newDsoft_label_sql$: $end_newDsoft_label_sql$
'$newDsoft_label_params$:$end_newDsoft_label_params$
'$newDsoft_label_fenye_num$: $end_newDsoft_label_fenye_num$
'$newDsoft_label_beizhu$:在添加页里的标签$end_newDsoft_label_beizhu$
'$newDsoft_is_sys_label$:0$end_newDsoft_is_sys_label$
'$newDsoft_other_params$:htmledxa:|htmledxb:$end_newDsoft_other_params$
'$end_ext_newDsoft%><%

set rs=server.createobject("adodb.recordset")
sql1="select * from ND_diqu_city"
rs.open sql1,newdsoft_conn_obj,1,1
%>
<script language = "JavaScript">
var onecount;
onecount=0;
subcat = new Array();
        <%
        count = 0
        do while not rs.eof 
        %>
subcat[<%=count%>] = new Array("<%= trim(rs("city"))%>","<%= trim(rs("father"))%>","<%= trim(rs("cityid"))%>");
        <%
        count = count + 1
        rs.movenext
        loop
        rs.close
        %>
onecount=<%=count%>;

function changelocation(locationid)
    {
    document.all.$post$myname$_city.length = 0; 

    var locationid=locationid;
document.all.$post$myname$_city.options[0] = new Option('市级', '');
    var i;
    for (i=0;i < onecount; i++)
        {
            if (subcat[i][1] == locationid)
            { 
                document.all.$post$myname$_city.options[document.all.$post$myname$_city.length] = new Option(subcat[i][0], subcat[i][2]);
            }        
        }
        
    }    
</script>

<%
sql1 = "select * from ND_diqu_area"
rs.open sql1,newdsoft_conn_obj,1,1
%> 
<script language = "javascript"> 
var onecount2; 
onecount2=0; 
subcat2 = new Array(); 
<% 
count2 = 0 
do while not rs.eof 
%> 
subcat2[<%=count2%>] = new Array("<%= trim(rs("area"))%>","<%= trim(rs("father"))%>","<%= trim(rs("areaid"))%>"); 
<% 
count2 = count2 + 1 
rs.movenext 
loop 
rs.close 
%> 
onecount2=<%=count2%>; 

function changelocation2(locationid) 
{ 
document.all.$post$myname$_area.length = 0; 

var locationid=locationid;
var j; 
document.all.$post$myname$_area.options[0] = new Option('县级','');
for (j=0;j < onecount2; j++) 
{ 
if (subcat2[j][1] == locationid) 
{ 
document.all.$post$myname$_area.options[document.all.$post$myname$_area.length] = new Option(subcat2[j][0], subcat2[j][2]); 
} 
} 

} 
</script> 



<select name="$post$myname$_province" id="$post$myname$_province" onChange="changelocation(document.all.$post$myname$_province.options[document.all.$post$myname$_province.selectedIndex].value);changelocation2(document.all.$post$myname$_city.options[document.all.$post$myname$_city.selectedIndex].value);">
    <option value="" selected>省级</option>
<%
   sql1="select * from ND_diqu_province"
   rs.open sql1,newdsoft_conn_obj,1,1
   do while not rs.eof
%>
<option value="<%=rs("provinceid")%>"><%=rs("province")%></option>
<%
   rs.movenext
   loop
   rs.close
%>
</select>
<select name="$post$myname$_city" id="$post$myname$_city" onChange="changelocation2(document.all.$post$myname$_city.options[document.all.$post$myname$_city.selectedIndex].value);">
    <option  value="" selected>请选择市</option>
</select>
<select name="$post$myname$_area" id="$post$myname$_area">
    <option value="" selected>请选择县</option>
</select>